﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Marbles.Core.Web.Syndication;
using Marbles.Core.Web.Syndication.Atom;
using Marbles.Core.Web.Syndication.RSS;
using Marbles.Core.Web.Resources;

namespace Marbles.Core.Web.Controls.WebParts
{
    [ToolboxData("<{0}:WidgetContainer runat=server></{0}:WidgetContainer>")]
    public class WidgetContainer : WebPart
    {
        [Category("Behaviour")]
        public string WidgetUrl
        {
            get
            {
                object obj = ViewState["WidgetUrl"];
                if (obj == null) { return string.Empty; }
                return ((string)obj);
            }
            set { ViewState["WidgetUrl"] = value; }
        }


        protected override void Render(HtmlTextWriter writer)
        {
            AddAttributesToRender(writer);
            writer.AddAttribute("src", this.WidgetUrl);
            writer.AddAttribute("frameborder", "0");
            writer.AddAttribute("scrolling", "no");
            writer.RenderBeginTag("iframe");
            writer.RenderEndTag();
        }
    }
}
